<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link th:href="@{/erp/assets/css/bootstrap.min.css}" rel="stylesheet"/>
    <link rel="stylesheet" th:href="@{/erp/css/style.css}"/>
    <link rel="stylesheet" th:href="@{/erp/assets/css/ace.min.css}"/>
    <link rel="stylesheet" th:href="@{/erp/assets/css/font-awesome.min.css}"/>
    <link rel="stylesheet" th:href="@{/erp/Widget/zTree/css/zTreeStyle/zTreeStyle.css}" type="text/css">
    <link th:href="@{/erp/Widget/icheck/icheck.css}" rel="stylesheet" type="text/css"/>
    <!--[if IE 7]>
    <link rel="stylesheet" th:href="@{/erp/assets/css/font-awesome-ie7.min.css}"/>
    <![endif]-->
    <!--[if lte IE 8]>
    <link rel="stylesheet" th:href="@{/erp/assets/css/ace-ie.min.css}"/>
    <![endif]-->
    <script th:src="@{/erp/js/jquery-1.9.1.min.js}"></script>
    <script th:src="@{/erp/assets/js/bootstrap.min.js}"></script>
    <script th:src="@{/erp/assets/js/typeahead-bs2.min.js}"></script>
    <!-- page specific plugin scripts -->
    <script th:src="@{/erp/assets/js/jquery.dataTables.min.js}"></script>
    <script th:src="@{/erp/assets/js/jquery.dataTables.bootstrap.js}"></script>
    <script type="text/javascript" th:src="@{/erp/js/H-ui.js}"></script>
    <script type="text/javascript" th:src="@{/erp/js/H-ui.admin.js}"></script>
    <script th:src="@{/erp/assets/layer/layer.js}" type="text/javascript"></script>
    <script th:src="@{/erp/assets/laydate/laydate.js}" type="text/javascript"></script>
    <script type="text/javascript" th:src="@{/erp/Widget/zTree/js/jquery.ztree.all-3.5.min.js}"></script>
    <script th:src="@{/erp/js/lrtk.js}" type="text/javascript"></script>
    <title>供应商信息</title>
</head>
<body>
<div class="margin clearfix">
    <div class="detailed_style clearfix">
        <em class=""></em>
        <div class="shop_logo">
            <img th:src="'/'+${relations.company.companyImage}" width="100px" height="100px"/>
        </div>
        <ul class="shop_content clearfix">
            <li class="shop_name"><label class="label_name">企业名称：</label>
                <span class="info" th:text="${relations.company.companyName}"></span>
                <div class="Authenticate"><i class="icon-yxrz"></i><i class="icon-yhk"></i><i class="icon-sjrz"></i><i class="icon-grxx"></i></div>
            </li>

            <li><label class="label_name">企业类型：</label><span class="info" th:text="${relations.company.companyType}"></span></li>

            <li><label class="label_name">经营范围：</label><span class="info" th:text="${relations.company.businessScope}"></span></li>

            <li><label class="label_name">成立日期：</label><span class="info" th:text="${relations.company.creatTime}"></span>
            </li>
            <li><label class="label_name">状&nbsp;&nbsp;&nbsp;&nbsp;态： </label>&nbsp;&nbsp;<span class="label label-success radius" th:text="${relations.company.companyStatus}=='on'?'已认证':'待认证'"></span></li>

            <li><label class="label_name">申请人姓名：</label><span class="info" th:text="${relations.company.legal}"></span>
            </li>
            <li><label class="label_name">申请时间：</label><span class="info" th:text="${relations.company.creatTime}"></span>
            </li>
            <li><label class="label_name">电子邮箱：</label><span class="info" th:text="${relations.company.companyEmail}"></span>
            </li>
            <li><label class="label_name">固定电话：</label><span class="info" th:text="${relations.company.fixedTel}"></span>
            </li>
        </ul>
    </div>
    <div class="Store_Introduction">
        <div class="title_name">企业简介</div>
        <div class="info" ><br/>
            <span id="b"></span>
            <div id="a" style="display: none" th:text="${relations.company.companyIntroduction}"/>
     </div>
</div>

<div class=" page-content clearfix">
    <div id="products_style">

        <!--产品列表展示-->
        <div class="h_products_list clearfix" id="products_list">
            <div id="scrollsidebar" class="left_Treeview">
                <div class="show_btn" id="rightArrow"><span></span></div>
                <div class="widget-box side_content">
                    <div class="side_title"><a title="隐藏" class="close_btn"><span></span></a></div>
                    <div class="side_list">
                        <div class="widget-header header-color-green2"><h4 class="lighter smaller">企业产品列表</h4></div>
                        <div class="widget-body">
                            <div class="widget-main padding-8">
                                <div id="treeDemo" class="ztree"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <form hidden="hidden" class="product_form">
                <input name="companyId" th:value="${companyId}">
                <input name="nodeId" value="" id="nodeId">
            </form>
            <div class="table_menu_list" id="testIframe">
                <table class="table table-striped table-bordered table-hover" id="sample-table">
                    <thead>
                    <tr>
                        <th width="60px">序号</th>
                        <th width="60px">产品编号</th>
                        <th width="250px">产品名称</th>
                        <th width="100px">价格（元）</th>
                        <th width="180px">生产时间</th>
                        <th width="80px">审核状态</th>
                    </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="Button_operation">
        <button onClick="javascrtpt:window.location.href='/supplier/my_supplier.html'" class="btn btn-primary radius" type="button"><i class="icon-save "></i>返回上一页</button>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
    $(function () {
        $('#b').empty().append($('#a').text());
    })
    //初始化宽度、高度
    $(".widget-box").height($(window).height() - 215);
    $(".table_menu_list").width($(window).width() - 260);
    $(".table_menu_list").height($(window).height() - 215);
    //当文档窗口发生改变时 触发
    $(window).resize(function () {
        $(".widget-box").height($(window).height() - 215);
        $(".table_menu_list").width($(window).width() - 260);
        $(".table_menu_list").height($(window).height() - 215);
    })

    $(function(){
        $('#nodeId').val('');
        //商品列表
        var table = $('#sample-table').dataTable({
            searching : false,  //取消本地搜索框
            serverSide: true,   //开始服务器分页
            aoColumnDefs: [
                {"orderable": false, "aTargets": [2, 4, 5]}// 制定列不参与排序
            ],
            ajax: {
                url : '/relation/productPage',
                type : 'post',
                data : function (d) {
                    var data = $('form').serialize();   //获取查询条件

                    //获取分页信息
                    var searchParams= {
                        start : d.start,
                        length : d.length
                    };
                    data = data + '&' + $.param(searchParams);
                    return data;
                }
            },
            columns : [
                { "data":"product.pnumber","createdCell": function (td,cellData,rowData,row,col) {
                        $(td).empty().append(row+1);
                    } },
                { "data": "product.pnumber" },
                { "data": "product.pname" },
                { "data": "product.pprice" },
                {"data": "order", "createdCell": function (td, cellData, rowData, row, col) {
                        if (cellData == null) {
                            $(td).empty().append('<span></span>');
                        } else{
                            $(td).empty().append('<span>'+rowData.order.productTime+'</span>');
                        }
                    }
                },
                {"data": "product.astatus", "createdCell": function (td, cellData, rowData, row, col) {
                        if(cellData=="1"){
                            $(td).empty().append('<span class="label label-success radius">已通过</span>');
                        }else if(cellData=="-1"){
                            $(td).empty().append('<span class="label label-defaunt radius">未通过</span>');
                        }
                    }
                }
            ]
        })

        /*******树状图*******/
        var setting = {
            async:{
                enable: true,
                url:'/categories/getCategories',
                autoParam : [ "id","pid","name"],
                otherParam : {"companyId" : "[[${companyId}]]"}
            },
            view: {
                showLine: false,
            },
            data: {
                simpleData: {
                    enable: true,
                    idKey: "id",
                    pIdKey: "pid",
                    rootPId: ""
                }
            },
            callback: {
                onClick : function (treeId, treeNode, d) {
                    $('#nodeId').val(d.id);
                    table.fnUpdate();
                }
            }
        };
        $.fn.zTree.init($("#treeDemo"), setting);
        var zTree = $.fn.zTree.getZTreeObj("tree");

    });
</script>
